<template>
	<view class="page">
		<view class="videoContent">
			<video class="video" loop id="demoVideo" autoplay :src="url" >
			</video>
		</view>
	</view>
</template>
<script>
	const NAME = "playVideo";
	 //var Screen = uni.requireNativePlugin('Yam-Screen');
	export default {
		data() {
			return {
				url: '',
				isShow: false
			}
		},
		onLoad() {
			if(this._route.query.url){
				this.url = this._route.query.url
			}
			if(wx.getScreenRecordingState){
			        wx.getScreenRecordingState({
			            success: res => {
							//uni.setUserCaptureScreen(false)
							//开启防录屏截屏
							//Screen.openAntiRecordScreen();
			                console.log(res.state)
			            }
			        })
			    }
			    if(wx.onScreenRecordingStateChanged){
			        wx.onScreenRecordingStateChanged(res => {
						//uni.setUserCaptureScreen(false)
						//开启防录屏截屏
						//Screen.openAntiRecordScreen();
			            console.log(res.state)
			        })
			    }
		},
		onShow() {
		    if (wx.setVisualEffectOnCapture) {
		      wx.setVisualEffectOnCapture({
		        visualEffect: 'hidden',
		        complete: function (res) {
		        }
		      })
		    }
		  },
		  // 页面隐藏和销毁时需要释放防截屏录屏设置
		    onHide(){
		      if (wx.setVisualEffectOnCapture) {
		        wx.setVisualEffectOnCapture({
		          visualEffect: 'none',
		          complete: function(res) {
		          }
		        })
		      }
			  if(wx.offScreenRecordingStateChanged){
			          // 取消录屏监听事件
			          wx.offScreenRecordingStateChanged()
			      }
		    },
		    onUnload(){
		      if (wx.setVisualEffectOnCapture) {
		        wx.setVisualEffectOnCapture({
		          visualEffect: 'none',
		          complete: function(res) {
		          }
		        })
		      }
			  if(wx.offScreenRecordingStateChanged){
			          // 取消录屏监听事件
			          wx.offScreenRecordingStateChanged()
			      }
		    },
		methods: {}
	}
</script>

<style lang="less">
	.page {
		width: 100%;
		height: 100%;
		
		.videoContent {
			width: 100%;
			height: 100%;
			background-color: #000000;
			
			video {
				width: 100%;
				height: 100%;
			}
		}
	}

	.bg-color-back {
		background-color: #000000;
		height: 150rpx;
		
		.view {
			margin-top: 30rpx;
			padding-left: 30rpx;
		}
	}

	.shopro-selector-rect {
		color: #FFFFFF;
		
		text {
			font-size: 44rpx;
		}

	}

	.VideoTitle {
		width: 100%;
		position: fixed;
		bottom: 85rpx;
		box-sizing: border-box;
		padding: 30rpx;
		left: 0;
		z-index: 100;
		
		.title {
			color: #FFFFFF;
			font-size: 40rpx;
			font-weight: bold;
		}
		
		.ct {
			color: #FFFFFF;
			font-size: 36rpx;
		}
	}
</style>
